/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package security;

import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Stateless;

/**
 *
 * @author Sigifredo Escobar Gómez
 */
@Stateless
public class AccountBean implements AccountBeanLocal {

    @RolesAllowed("users") // only members of users role can access
    @Override
    public void deposit(int acno, double amount) {
        System.out.println("Deposit method called");
    }

    @RolesAllowed("admin") // only members of admin role can access
    @Override
    public void close(int acno) {
        System.out.println("Closed account " + acno);
    }

    @PermitAll // anyone can access
    @Override
    public double getBalance(int acno) {
        System.out.println("Getting balance for " + acno);
        return 1000.0;
    }
}
